import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'

const app = createApp(App)

// 添加全局状态管理
app.config.globalProperties.$user = {
  isLoggedIn() {
    const user = localStorage.getItem('user')
    return user ? JSON.parse(user).isLoggedIn : false
  },
  getUserInfo() {
    const user = localStorage.getItem('user')
    return user ? JSON.parse(user) : null
  },
  logout() {
    localStorage.removeItem('user')
  }
}

app.use(router)

app.mount('#app')
